<?php
    include("../../includes/config.php");
    $returnUser = array();
    $donen = array();
    if($_GET['sSearch'] != "") { 
        $sSeach = mysql_real_escape_string($_GET['sSearch']);
        $where = "WHERE user_id LIKE '%".$sSeach."%' OR user_email LIKE '%".$sSeach."%' OR user_nome LIKE '%".$sSeach."%' OR user_cognome LIKE '%".$sSeach."%'";
        $toplam = 100;
    } else {
        $where = false;
        $toplu = $db->sql("SELECT COUNT(user_id) AS toplam FROM e_user");
        $toplam = $db->getir($toplu);
    }
    
    
    
    
    //echo $where;
    $userArray = $user->getMember(intval($_GET['iDisplayStart']),intval($_GET['iDisplayLength']),false,$where);
    
    $returnUser['sEcho'] = intval($_GET['sEcho']);
    $returnUser['iTotalRecords'] = $toplam['toplam'];
    $returnUser['iTotalDisplayRecords'] = $toplam['toplam'];
    //$returnUser['iTotalDisplayRecords'] = intval($_GET['iDisplayLength']);
   
    //$returnUser['aaData'] =  
    $x = 1;
    
    foreach($userArray as $key=>$val) {
        $returnUser['aaData'][] = array(
            $val['user_numid'],
            $val['user_id'],
            $val['user_nome']." ".$val['user_cognome'],
            $val['user_email'],
            ($val['user_attivato'] == '1') ? 'Aktif' : 'Pasif',
            ($val['user_gender'] == 'M') ? 'Bay' : 'Bayan',
            ($val['user_avatarinfo'] == '') ? 'Yok' : 'Var',
            ($val['fb_userid'] == '') ? 'Yok' : 'Var',
            $val['user_tckno'],
            $val['activation_date'],
            "<a href='index.php?module=member_edit&id=".$val['user_numid']."'>Düzenle</a>"
        );
    }
            
     
    echo json_encode($returnUser);

?>
